package com.easylinkin.core.models;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.Optional;

/**
 * 操作人
 *
 * @author kyj
 * @date 2024/5/17 15:32
 */
@ApiModel(description = "操作人")
@Data
public class Operator implements Serializable {
    /**
     * userId
     */
    @ApiModelProperty(value = "userId", position = 1, hidden = true)
    private String userId;

    /**
     * 用户名
     */
    @ApiModelProperty(value = "用户名", position = 2, hidden = true)
    private String username;

    /**
     * 昵称
     */
    @ApiModelProperty(value = "昵称", position = 3, hidden = true)
    private String nickname;

    /**
     * 租户id、项目id
     */
    @ApiModelProperty(value = "租户id、项目id", position = 4, hidden = true)
    private String tenantId;

    /**
     * 操作时间
     */
    @ApiModelProperty(value = "操作时间", position = 5, hidden = true)
    private LocalDateTime now;

    public LocalDateTime getNow() {
        this.now = Optional.ofNullable(now).orElseGet(LocalDateTime::now);
        return now;
    }
}
